package com.aisino.client;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import com.aisino.bean.Electronic;
import com.aisino.bean.ElectronicDetail;
import com.aisino.utils.ResultInfo;
import com.aisino.webs.FPServiceAPI;
import com.hxhy.bean.BElectronic;
import com.hxhy.util.Tools;

public class FPInfo {

	static String lp = "2";
	static String hp = "4";

	public static void main(String[] args) {
//		kp();
		search("9c08df42c0a803c94a50dbbfdf908c1f", lp);
		search("9c08df42c0a803c94a50dbbfdf908c1f", hp);
//		hc("6a7f2a99c0a803c92068e602cfdd1bca");
	}

	static void kp() {
		String lsh = Tools.getUUID();
		System.out.println("lsh:" + lsh);
		Electronic e = new Electronic("91610116783555749D", "西安市长安区新区热力有限公司", "西安市长安区韦郭路中段", "", "1604011009100058362",
				"张晓艳", "张晓艳", "王育希");
		e.setGhfmc("魏莺歌");
		e.setGhf_nsrsbh("");
		e.setGhf_dz("雅居乐铂琅峯17号楼011302");
		e.setGhf_sj("18502988255");
		e.setGhf_email("185228998@qq.com");
		e.setGhfqylx("03");
		e.setBz("用户编号：108817011302");
		List<ElectronicDetail> eds = new ArrayList<ElectronicDetail>();
		e.setKpxm(eds);
		// mx
		ElectronicDetail ed = new ElectronicDetail();
		ed.setXmmc(Tools.toString("居民"));
		ed.setXmdw("平方米");
		ed.setHsbz("0");
		ed.setFphxz("0");
		ed.setXmdj(new BigDecimal("23.20"));
		ed.setGgxh("2020-2021供暖季");
		ed.setSpbm("1100102010100000000");
		ed.setYhzcbs("1");
		ed.setLslbs("1");
		ed.setZzstsgl("免税");
		ed.setXmje(new BigDecimal("2228.36"));
		ed.setKce(new BigDecimal("2228.36"));
		ed.setSl(BigDecimal.ZERO);
		ed.setSe(BigDecimal.ZERO);
		eds.add(ed);

		if (!e.kpInvoice()) {
			System.out.println(e.get());
			return;
		}
		System.out.println(e.get());
		ResultInfo info = new FPServiceAPI().getFPServiceAPIHttpPort().createUser(e.get());
		System.out.println(info.getMessage().getValue());
	}

	static void search(String ddbh, String type) {
		Electronic kp = new Electronic();
		kp.setDdbh(ddbh);
		kp.setIs_apply(type);
		kp = Electronic.spInvoice(kp);
		ResultInfo info = new FPServiceAPI().getFPServiceAPIHttpPort().createUser(kp.get());
		System.out.println(info.getMessage().getValue());
	}

	static void hc(String ddbh) {
		BElectronic ele = new BElectronic();
		ele.setLsh(ddbh);
		Electronic e = Electronic.hpInvoice(ele);
		ResultInfo info = new FPServiceAPI().getFPServiceAPIHttpPort().createUser(e.get());
		System.out.println(info.getMessage().getValue());
	}
}
